<div class="bjui-pageContent">
    <table class="table table-bordered" data-toggle="datagrid" data-options="{
        height: '100%',
        gridTitle : '权限分配',
        showToolbar: true,
        toolbarItem: 'edit,|,save,|,cancel',
        local: 'local',
        dataUrl: '/admin/user/permission-assignment',
        editUrl: '/admin/user/save-permission-assignment',
        showCheckboxcol: true,
        linenumberAll: true,
        sortAll: false,
        contextMenuH: true,
        paging: {showPagenum:10, selectPageSize:'20,50,100', pageCurrent:1, pageSize:20},
        fieldSortable: false,
        columnMenu: false,
        postData: {role_id:{{ $roleId }}},
        showEditbtnscol: '操作',
        customEditbtns: {width:150,position:'replace',buttons:datagrid_tree_operation},
    }">
        <thead>
        <tr>
            {{--<th data-options="{name:'pid',align:'center',width:100,type:'select',items:function(){return $.getJSON('http://b-jui.com/demo/listDepart?callback=?')},itemattr:{value:'deptcode',label:'deptname'}}">顶部菜单</th>--}}
            {{--<th data-options="{name:'pid',align:'center',width:100,type:'select',items:function(){return $.getJSON('http://b-jui.com/demo/listDepart?callback=?')},itemattr:{value:'deptcode',label:'deptname'}}">左侧菜单</th>--}}
            <th data-options="{name:'name',align:'center',width:150,add:false,edit:false}">菜单名</th>
            <th data-options="{name:'permission',align:'center',width:100,type:'select',items:[{'1':'激活'},{'0':'禁止'}]}">权限</th>
        </tr>
        </thead>
    </table>
</div>

<script type="text/javascript">
    // 操作列
    function datagrid_tree_operation() {
        var html = ' <button type="button" class="btn btn-green bjui-datagrid-btn edit"><i class="fa fa-edit"></i> 编辑</button>'
                + ' <button type="button" class="btn btn-green bjui-datagrid-btn update"><i class="fa fa-edit"></i> 更新</button>'
                + ' <button type="button" class="btn btn-green bjui-datagrid-btn save"><i class="fa fa-check"></i> 保存</button>'
                + ' <button type="button" class="btn btn-orange bjui-datagrid-btn cancel"><i class="fa fa-undo"></i> 取消</button>'

        return html
    }
</script>